package top.dotgo.kit.oss;


import lombok.Getter;

import java.io.IOException;
import java.util.Properties;

/**
 * oss的配置内容
 *
 * @author : lin
 * @date : 2019/03/03 16:12
 */

class OssConfig {

    /**
     * oss文件前缀
     */
    private static Properties prop = new Properties();
    @Getter
    private static final String ENDPOINT = prop.getProperty("endpoint");
    @Getter
    private static final String ACCESS_KEY_ID = prop.getProperty("accessKeyId");
    @Getter
    private static final String ACCESS_KEY_SECRET = prop.getProperty("accessKeySecret");
    @Getter
    private static final String ROLE_ARN = prop.getProperty("roleArn");
    @Getter
    private static final String BUCKET = prop.getProperty("bucket");
    @Getter
    private static final String REGION = prop.getProperty("region");
    @Getter
    private static final Integer EXPIRATION = Integer.valueOf(prop.getProperty("expiration"));
    @Getter
    private static final Integer DURATION_SECONDS = Integer.valueOf(prop.getProperty("durationSeconds"));

    @Getter
    private static final String PREFIX = "http://" + BUCKET + "." + ENDPOINT;

    static {
        try {
            prop.load(OssConfig.class.getResourceAsStream("/oss/oss.properties"));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
